home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10015 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: enea.se!usenet
  2. From: tope@enea.se (Tommy Petersson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: VC++ 4.0 OLE Components: CPicClipCtrl / CPicture - HELP!
  5. Date: 5 Mar 1996 17:22:36 GMT
  6. Organization: Enea Data AB
  7. Message-ID: <4hht8s$6q8@gordon.enea.se>
  8. References: <4hf9mn$33j@gordon.enea.se>
  9. NNTP-Posting-Host: fixotrix.enea.se
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. In article <4hf9mn$33j@gordon.enea.se>, tope@enea.se says...
  15. >
  16. >Hi, I have a problem with Visual C++ 4.0:
  17. >
  18. >In a dialog I need to display a small picture in a window, but
  19. >the picture displayed will depend on a value in a variable. For
  20. >this I use the MS-supplied OLE component Picture Clip Control.
  21. >
  22. >The control stores a matrix of small pictures in an object of
  23. >class CPicture and by a call to GetGraphicCell I get the chosen
  24. >part of the matrix returned as a CPicture object.
  25. >
  26. >However, the supplied documentation is totally Visual Basic-
  27. >oriented - it just tells me to "set the picture property to the
  28. >value returned by the GraphicCell call". Usually a picture control
  29. >in VB corresponds to a Static Bitmap control in VC++. Just use
  30. >the SetBitmap member function.
  31. >
  32. >But - SetBitmap wants a struct HWND and GetGraphicCell returns
  33. >a CPicture... And I can't find anything useful in the CPicture
  34. >class, since it's not derived fron CWnd or any other class where you
  35. >just call another member function which kindly returns a window.
  36. >
  37. >Shouldn't I use a static control? Should I put a CPicture in
  38. >the dialog instead? How do I get to it then - for the other controls
  39. >in the dialog I simply let ClassWizard add member variables but
  40. >ClassWizard doesn't understand CPicture. If I change from CStatic
  41. >to CPicture I get an error at the DDX call. And I don't think that
  42. >a CPicture is automatically displayed in a dialog the same way as
  43. >a CStatic is(?)
  44. >
  45. >Thanks in advance,
  46. >BTW - is this the best newsgroup for this question, I found no VC++
  47. >specific?
  48. >
  49. >Tommy Petersson
  50. >tope@enea.se
  51. >
  52.  
  53. A MicroSoft tip is to use the MS OLE Grid Control and have it show
  54. a picture. Their example puts some code into OnInitDialog:
  55.  
  56. CPictureHolder pictholder;
  57. pictholder.CreateFromBitmap(IDR_MAINFRAME);
  58. m_grid.SetPicture(pictholder.GetPictureDispatch());
  59.  
  60. And that's of course great if I want to display the toolbar in a
  61. dialog... But if I have a CPicture returned from GetGraphicCell?
  62. Where does it come in?
  63.  
  64. /Tommy Petersson
  65. tope@enea.se
  66.  
  67.